package com.baoyouqun.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baoyouqun.entity.DemandInteract;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;


@Mapper
public interface DemandInteractMapper extends BaseMapper<DemandInteract> {

    @Select("""
                <script>
                SELECT demand_id as demandId, type
                FROM demand_interact
                WHERE user_id = #{userId}
                  AND demand_id IN
                  <foreach collection='demandIds' item='id' open='(' separator=',' close=')'>
                    #{id}
                  </foreach>
                </script>
            """)
    List<Map<String, Object>> queryUserActions(@Param("userId") String userId, @Param("demandIds") List<String> demandIds);
}